<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>首页</title>
    {include file='common/require'/}
    <script>
        var currentLeftNavItem = 'client'
    </script>
</head>

<body>

    {include file='common/left_menu'/}

    <div class="main-container">
        <div class="main-header">
            <span class="layui-breadcrumb">
                <a href="">首页</a>
                <a href="">客户端管理</a>
                <a href=""><cite>选择客户端</cite></a>
            </span>
        </div>

        <div class="main-body">
            <div>
                <blockquote class="layui-elem-quote">请先选择客户端。</blockquote>
            </div>
            <div class="control-container">
                <div class="layui-btn-container">
                        <div class="layui-btn layui-btn-normal create">增加客户端</div>
                </div>
                <div class="right-container">
                    <form action="">
                        {volist name='$Request.param' id='vo'}
                            <input type="hidden" name="{$key}" value="{$vo}">
                        {/volist}
                        <div>
                            <input style="width: 160px;display: inline-block;" type="text" name="keywords"
                                class="layui-input" value="{$Request.param.keywords}" placeholder="请输入关键字">
                            <button class="layui-btn layui-btn-normal">搜索</button>
                        </div>
                    </form>
                </div>
            </div>
            <div>
                <table class="layui-table" lay-skin="line" lay-size="sm">
                    <colgroup>
                        <col width="50">
                        <col width="100">
                        <col width="150">
                        <col width="300">
                        <col>
                        <col>


                    </colgroup>
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>客户端名称</th>
                            <th>key</th>

                            <th>备注</th>
                            <th>状态</th>
                            <th>操作</th>

                        </tr>
                    </thead>
                    <tbody>
                        {volist name='client_list' id='vo'}
                        <tr data-item="{$vo->toJson()}">

                            <td>{$vo.id}</td>
                            <td>
                                <span class="name">{$vo.name}</span>
                            </td>
                            <td>
                                <span class="key">{$vo.key}</span>
                            </td>
                            <td>
                                <span class="comment">{$vo.comment}</span>
                            </td>
                            <td>
                                <span class="set-status switch-text">{$vo.status}</span>
                            </td>
                            <td>
                                <div class="layui-btn-container">
                                    <a class="layui-btn layui-btn-sm layui-btn-normal" href="{:url(input('target','Channel/create'),['client_id'=>$vo.id])}">选择</a>
                                </div>
                            </td>

                        </tr>
                        {/volist}
                        {empty name='client_list'}
                        <tr>
                            <td colspan="7">暂无内容</td>
                        </tr>
                        {else /}
                        {/empty}

                    </tbody>
                </table>
                <div>
                    {$client_list->render()|raw}
                </div>
            </div>
        </div>
    </div>
    {include file='common/footer'/}
    <script>
        
        $('.create').click(function(){
            var item = this;

            layer.prompt({
                title:'客户端名称'
            },function(value,index){
                $.post('{:url("save")}',{
                    name:value
                },function(result){
                    if(result.code == 0){
                        layer.msg('添加成功')
                        setTimeout(() => {
                            location.reload()
                        }, 1200);
                    }else{
                        layer.msg(result.msg)
                    }
                })
            })
        })
    </script>
</body>

</html>